package com.txw.hellojkxy;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import org.greenrobot.eventbus.EventBus;

public class SecondActivity extends AppCompatActivity {

    private static final String TAG ="SecondActivity" ;
    private EditText etSend;
    private Button btnSend;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        etSend= (EditText) findViewById(R.id.et_send);

        btnSend= (Button) findViewById(R.id.btn_send);

        btnSend.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name=etSend.getText().toString().trim();

                MessageEvent messageEvent=new MessageEvent(name);

                EventBus.getDefault().post(messageEvent);

                SecondActivity.this.finish();

            }
        });

    }





}
